package com.example.smartclassroom.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.util.ArrayList;
import java.util.List;

@Configuration
public class InterceptConfig implements WebMvcConfigurer {
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        //放行路径
        List<String> excludePath = new ArrayList<>();
        //放行
        excludePath.add("/admin/user-login");
        excludePath.add("/admin/register");
        registry.addInterceptor(new InterceptController())
                .addPathPatterns("/admin/*/**")
                .addPathPatterns("/course/*/**")
                .excludePathPatterns(excludePath);
    }

}
